<?php
require 'vendor/server.php';

session_start();

//Slim
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();

//ORM
require 'vendor/Paris/idiorm.php';
require 'vendor/Paris/paris.php';
ORM::configure('mysql:host='.SERVER.';dbname='.DB_NAME.'');
ORM::configure('username', DB_USERNAME);
ORM::configure('password', DB_PASSWORD);

// Inicia Slim
$app = new \Slim\Slim(array(
    'debug' => true,
    'log.level' => \Slim\Log::DEBUG,
    //'cookies.secret_key'  => 'MY_SALTY_PEPPER',
    'cookies.lifetime' => time() + (1 * 24 * 60 * 60), // = 1 day
    //'cookies.cipher' => MCRYPT_RIJNDAEL_256,
    //'cookies.cipher_mode' => MCRYPT_MODE_CBC
	
));

// para logueo de aplicacion
require 'interceptor/LogController.php';
$app->add(new \LogController());
	
//Services
require 'services/WebServiceTecnico.php';

//Models
require 'entities/Usuario.php';
require 'entities/Empresa.php';
require 'entities/Asistente.php';
require 'entities/Tecnico.php';
require 'entities/EstadoTecnico.php';
require 'entities/EstadoTarea.php';
require 'entities/AdmAplicacion.php';
require 'entities/Perfil.php';
require 'entities/Cliente.php';
require 'entities/Reporte.php';
require 'entities/Tarea.php';
require 'entities/TipoTarea.php';
require 'entities/TipoIdentificacion.php';
require 'entities/TareaRechazada.php';

//Controllers
require 'controllers/EmpresaService.php';
require 'controllers/TecnicoService.php';
require 'controllers/UsuarioService.php';
require 'controllers/AdmAplicacionService.php';
require 'controllers/PerfilService.php';
require 'controllers/AsistenteService.php';
require 'controllers/TareaService.php';
require 'controllers/ReportService.php';
require 'controllers/ClienteService.php';
require 'controllers/EstadoTecnicoService.php';
require 'controllers/TipoIdentificacionService.php';
require 'controllers/EstadoTareaService.php';
require 'controllers/TipoTareaService.php';

$app->get('/', function () use($app){
	$app->render('../web/pages/commons/home.php');
});

// $app->map('/login', function () use ($app) {
// 	 		
	 // $app->render('/../web/pages/commons/home.php');
// 
// });

$app->run();
?>

